home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 30
/
Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso
/
Aminet
/
gfx
/
show
/
FV21BETA-src.lha
/
FV21BETA-src
/
BestModeID.c
next >
Wrap
C/C++ Source or Header
|
1997-08-25
|
2KB
|
62 lines
#include <cybergraphics/cybergraphics.h>
#include <dos/dosasl.h>
#include <exec/execbase.h>
#include <exec/memory.h>
#include <exec/types.h>
#include <proto/cybergraphics.h>
#include <proto/dos.h>
#include <proto/exec.h>
#include <utility/tagitem.h>
char template[]="DEPTH/A/N,NOMW/A/N,NOMH/A/N";
struct {ULONG *depth;
ULONG *nomw;
ULONG *nomh;} arglist={NULL};
struct Library *CyberGfxBase;
ULONG main() {
ULONG errorcode;
ULONG modeid;
struct RDArgs *readarg;
errorcode=RETURN_FAIL;
if((DOSBase=(struct DosLibrary *)OpenLibrary("dos.library",37))!=0) {
if((CyberGfxBase=OpenLibrary("cybergraphics.library",40))!=0) {
if((readarg=ReadArgs(template,(LONG *)&arglist,0))!=0) {
modeid=BestCModeIDTags(CYBRBIDTG_Depth,*arglist.depth,CYBRBIDTG_NominalWidth,*arglist.nomw,CYBRBIDTG_NominalHeight,*arglist.nomh);
if(modeid==INVALID_ID) {
PutStr("No displaymode matching your parameters was found.\n");
}
else {
ULONG w,h,d;
w=GetCyberIDAttr(CYBRIDATTR_WIDTH,modeid);
h=GetCyberIDAttr(CYBRIDATTR_HEIGHT,modeid);
d=GetCyberIDAttr(CYBRIDATTR_DEPTH,modeid);
VPrintf("ModeID: $%08lx ",&modeid);
VPrintf("Width: %4ld ",&w);
VPrintf("Height: %4ld ",&h);
VPrintf("Depth: %2ld\n",&d);
}
errorcode=0;
FreeArgs(readarg);
}
CloseLibrary(CyberGfxBase);
}
else {
PutStr("Couldn't open cybergraphics.library V40\n");
}
CloseLibrary((struct Library *)DOSBase);
}
return(errorcode);
}